<template>
	<view class="content-class">
		<view class="jkzs-border" v-for="(i, iIndex) in personList" :key="iIndex" @click="skipHealthData(i)">
			<view class="jkzs">
				<view class="health-card">
					<u-row class="header">
						<u-row>
							<u-image style="margin-right:8px" width="18px" height="18px"
								src="../../static/images/homePage/cyjk.png"></u-image>
							{{ i.name }}
						</u-row>
						<u-row>
							测量时间 : {{ i.time }}
							<u-image style="margin-left:10px" width="20px" height="20px"
								src="../../static/images/measuring/arrow.png"></u-image>
						</u-row>
					</u-row>
					<u-row class="jkzs-status">
						<u-row>
							<u--image src="/static/images/my/qd.png" width="13px" height="13px"></u--image>
							连接状态 :
							已连接
						</u-row>
						<u-row>
							<u--image src="/static/images/my/dl.png" width="13px" height="13px"></u--image>
							当前电量 :
							93 <span>%</span>
						</u-row>
					</u-row>
					<u-row class="health-info" v-for="item in 3" :key="item">
						<u-col :span="4" v-for="i in getCardList(item)" :key="i.title">
							<view class="sport-card">
								<u-row>
									<u-image style="margin-right: 3px;" width="11px" height="11px"
										:src="i.icon"></u-image>
									{{ i.title }}
								</u-row>
								<view v-if="i.unit1" class="number">
									{{ i.subTitle ? i.subTitle.split('h')[0] : '' }}<span>{{ i.unit }}</span>{{
			i.subTitle ?
				i.subTitle.split('h')[1].replace('min', '') : '' }}<span>{{ i.unit1 }}</span>
								</view>
								<view v-else class="number">{{ i.subTitle }}<span>{{ i.unit }}</span></view>
							</view>
						</u-col>
					</u-row>
					<u-row class="health-info error-info">
						<u-row>
							<u-icon name="bell" color="#fff" size="14"></u-icon>
							身体异常信息
						</u-row>
						<u-row>
							<u-badge bgColor="#FF2B2C" :value="2"></u-badge>
							<u-icon style="margin-left: 8px;" name="arrow-right" color="#999" size="14"></u-icon>
						</u-row>
					</u-row>
				</view>
			</view>
		</view>
		<view class="bottom-btn">
			<view class="sport-btn">添加成员</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				personList: [{
					name: '张元英',
					time: '12:00',
					phone: 123564687953
				}, {
					name: 'LIZ',
					time: '12:00',
					phone: 123564687953
				}],
				cardList1: [{
					title: '入睡时间',
					icon: require("../../static/images/ai/rssj.png"),
					subTitle: '00:05',
				}, {
					title: '睡眠质量',
					icon: require("../../static/images/ai/smzl.png"),
					subTitle: '95',
					unit: '分',
				}, {
					title: '起床时间',
					icon: require("../../static/images/ai/qcsj.png"),
					subTitle: '07:25',
				}],
				cardList2: [{
					title: '平均心率',
					icon: require("../../static/images/ai/pjxl.png"),
					subTitle: '55',
					unit: 'bpm',
				}, {
					title: '平均血氧',
					icon: require("../../static/images/ai/pjxy.png"),
					subTitle: '95',
					unit: '%',
				}, {
					title: '平均体温',
					icon: require("../../static/images/ai/pjtw.png"),
					subTitle: '36.6',
					unit: '℃',
				}],
				cardList3: [{
					title: '运动步数',
					icon: require("../../static/images/ai/ydbs.png"),
					subTitle: '65482',
					unit: '步',
				}, {
					title: '消耗热量',
					icon: require("../../static/images/ai/xhrl.png"),
					subTitle: '230.19',
					unit: 'kcal',
				}, {
					title: '运动距离',
					icon: require("../../static/images/ai/ydjl.png"),
					subTitle: '5.26',
					unit: 'km'
				}]
			}
		},
		methods: {
			skipHealthData(i) {
				uni.navigateTo({
					url: "/pages/HealthData/HealthData?person=" + JSON.stringify(i)
				})
			},
			getCardList(i) {
				return this[`cardList${i}`]
			}

		}
	}
</script>

<style scoped lang="scss">
	.content-class {
		padding: 15px 15px 100px 15px;

		.jkzs-border {
			margin-bottom: 12px;
		}

		.error-info {
			padding: 12px 0px;
			font-size: 12px;
			justify-content: space-between !important;
		}

		.health-info {
			background: #1B1B1B;
			border-radius: 6px;
			padding: 12px;
			margin-bottom: 12px;

			.sport-card {
				display: flex;
				flex-direction: column;
				align-items: center;
				font-size: 12px;
				color: #999999;

				.number {
					font-size: 20px;
					color: #FFFFFF;
					margin-top: 6px;

					span {
						font-size: 8px;
						margin: 0px 1px;
					}
				}
			}
		}

		.bottom-btn {
			position: fixed;
			bottom: 0px;
			background-color: #0B0F12;
			width: calc(100% - 30px);

			.sport-btn {
				margin: 0px 20px 15px 20px;
				width: calc(100% - 40px);
				display: flex;
				align-items: center;
				background: linear-gradient(90deg, #FFD8BB 0%, #F0986A 100%);
				border-radius: 30px;
				font-size: 18px;
				color: #0B0F12;
				text-align: center;
				justify-content: center;
				height: 52px;
				font-weight: bold;
			}
		}

		.health-card {
			.header {
				padding-bottom: 16px;
				justify-content: space-between !important;
				font-size: 15px;
				border-bottom: 1px solid #EEEEEE
			}

			.header .u-row:last-child {
				font-size: 12px;
				color: #999999;
			}

			.jkzs-status {
				margin: 12px 0px;
				font-size: 12px;

				.u-icon {
					margin-right: 3px;
				}

				::v-deep .u-image {
					margin-right: 3px;
				}

				span {
					font-size: 8px;
					color: #fff;
					margin-top: 2px;
					margin-left: 2px;
				}
			}


			.jkzs-status .u-row:first-child {
				margin-right: 15px;
				color: #FFD8BB;
			}

			.jkzs-status .u-row:last-child {
				color: #54D7A5;
			}


		}
	}
</style>